// 2. 递归拷贝
function deepClone(source){
    let target = null
    if(typeof source === 'object'){
        target = (Object.prototype.toString.call(source)==='[object Array]') ? [] :{}
        for(let key in source){
            target[key] = deepClone(source[key])
        }
    }else {
        target = source
    }
    return target
}




//收取地址模块
const Address = {
    getAddress(){
        console.log('获取收货地址...')
    }
}

//积分模块
const Credit = {
    total(){
        console.log('积分统计...')
    }
}

//请求后台模块
const Request={
    ajax(){
        console.log('后台请求...')
    }
}

//流量模块
function Flow(){}
Flow.prototype.find = function(){
    console.log('vip...')
}
Flow.prototype.recharge=function(){
    console.log('流量充值...')
}
Flow.prototype.obj={
    get(){
        console.log('flow obj get...')
    }
}



//管理员
function Admin(){}

Admin.prototype = Object.assign({},deepClone(Address),deepClone(Credit),deepClone(Request),Flow.prototype)
Admin.prototype.obj={
    get(){
        console.log('Admin obj get...')
    }

}

//测试：
const admin = new Admin()
admin.getAddress() // 获取收货地址...
admin.total() // 积分统计...
admin.ajax() // 后台请求...
admin.find() // 流量查询...
admin.recharge() // 流量充值...


console.log()
let flow = new Flow()
admin.obj.get() // Admin obj get...
flow.obj.get() // flow obj get...